package com.source.hotelbath.activity;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.source.hotelbath.R;
import com.source.hotelbath.base.CustomerAdapter;
import com.source.hotelbath.model.OperateBean;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by ZhouMeng on 2017/10/8.
 */

public class OperateAdapter extends CustomerAdapter {

    private Context mContext;
   private List<OperateBean> operateList = new ArrayList<>();

    public OperateAdapter(Context mContext, List<OperateBean> operateList) {
        this.mContext=mContext;
        this.operateList=operateList;
    }

    @Override
    public int getCount() {
        return operateList.size();
    }

    @Override
    public Object getItem(int position) {
        return getItem(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
       ViewHolder holder;
        if (null == convertView) {
            holder = new ViewHolder();
            convertView = LayoutInflater.from(mContext).inflate(R.layout.adapter_operate, null);
            holder.tv_type = (TextView) convertView.findViewById(R.id.tv_type);
            holder.tv_time = (TextView) convertView.findViewById(R.id.tv_time);
            holder.tv_person = (TextView) convertView.findViewById(R.id.tv_person);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        if ("01".equals(operateList.get(position).getOperateType())){
            holder.tv_type.setText("取");
        }else {
            holder.tv_type.setText("收");
        }
        holder.tv_time.setText("确认时间："+operateList.get(position).getCreateTimeDescp());
        holder.tv_person.setText("确认人员："+operateList.get(position).getOperator());
        return convertView;
    }
    class ViewHolder{
        TextView tv_type;
        TextView tv_time;
        TextView tv_person;
    }
}
